home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / quick / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  4.6 KB  |  143 lines

  1. VERSION 2.00
  2. Begin Form Quick 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Quick Exit"
  6.    ClientHeight    =   1095
  7.    ClientLeft      =   1800
  8.    ClientTop       =   1755
  9.    ClientWidth     =   3255
  10.    Height          =   1785
  11.    Icon            =   FORM1.FRX:0000
  12.    Left            =   1740
  13.    LinkTopic       =   "Quick"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   1095
  16.    ScaleWidth      =   3255
  17.    Top             =   1125
  18.    Width           =   3375
  19.    Begin CommandButton Command1 
  20.       Caption         =   "Re&boot"
  21.       Height          =   1095
  22.       Index           =   2
  23.       Left            =   2160
  24.       TabIndex        =   2
  25.       Top             =   0
  26.       Width           =   1095
  27.    End
  28.    Begin CommandButton Command1 
  29.       Caption         =   "E&xit"
  30.       DragIcon        =   FORM1.FRX:0302
  31.       Height          =   1095
  32.       Index           =   1
  33.       Left            =   1080
  34.       TabIndex        =   1
  35.       Top             =   0
  36.       Width           =   1095
  37.    End
  38.    Begin CommandButton Command1 
  39.       Caption         =   "&Restart"
  40.       DragIcon        =   FORM1.FRX:0604
  41.       Height          =   1095
  42.       Index           =   0
  43.       Left            =   0
  44.       TabIndex        =   0
  45.       Top             =   0
  46.       Width           =   1095
  47.    End
  48.    Begin Menu File 
  49.       Caption         =   "&File"
  50.       Begin Menu Exit 
  51.          Caption         =   "E&xit"
  52.       End
  53.    End
  54.    Begin Menu Options 
  55.       Caption         =   "&Options"
  56.       Begin Menu Stay 
  57.          Caption         =   "&Stay On Top"
  58.       End
  59.       Begin Menu Warn 
  60.          Caption         =   "&Warnings"
  61.       End
  62.    End
  63.    Begin Menu About 
  64.       Caption         =   "&About"
  65.    End
  66. Declare Function ExitWindows Lib "User" (ByVal dwReturnCode As Long, ByVal wReserved As Integer) As Integer
  67. 'Return To Dos
  68. Const EW_ExitWindows = &H0
  69. 'Reboot Computer
  70. Const EW_Rebootsystem = &H43
  71. 'Restart Windows
  72. Const Ew_RestartWindows = &H42
  73. Declare Sub setWindowPos Lib "User" (ByVal H%, ByVal HB%, ByVal X%, ByVal Y%, ByVal Cx%, ByVal Cy%, ByVal F%)
  74.     Const SWP_NOSIZE = &H1 'Ignore size parameters
  75.     Const SWP_NOMOVE = &H2 'Ignore position parameters
  76.     Const SWP_SHOWWINDOW = &H40 'Display Windows
  77.     Const HWND_TOPMOST = -1 'Make window float
  78. Const MB_YESNO = 4 'Define Buttons
  79. Const MB_ICONINFORMATION = 64 'Define Icon
  80. Const MB_DEFBUTTON2 = 256, IDYES = 6, IDNO = 7 'Define Other
  81. Sub About_Click ()
  82. Load about1
  83. captiontext0 = "This program is Freeware. Enjoy it!" + Chr$(10)
  84. captiontext1 = "If you have any suggestions, I can be" + Chr$(10)
  85. captiontext2 = "reached by e-mail at abciiia@aol.com" + Chr$(10)
  86. captiontext3 = "or by snail mail at" + Chr$(10)
  87. captiontext4 = "A.B. Collver III" + Chr$(10) + "6701 San Bonita, Apt 3BE" + Chr$(10) + "St. Louis, MO 63105"
  88. about1.Label3.Caption = captiontext0 + captiontext1 + captiontext2 + captiontext3 + captiontext4
  89. about1.Show 1
  90. End Sub
  91. Sub Command1_Click (Index As Integer)
  92. If warn.Checked <> True Then
  93.         GoTo Continue
  94.     Else Dim DgDef, Msg, Response, Title
  95. End If
  96. Continue:
  97. Select Case Index
  98.     Case 0 'If index = 0, Restart Windows In Current Mode
  99.         Msg = "Do you wish to Restart Windows?"
  100.         GoSub MessageBox
  101.         A% = ExitWindows(Ew_RestartWindows, 0)
  102.     Case 1 'If index = 1, Exit To Dos
  103.         Msg = "Do you wish to Exit Windows?"
  104.         GoSub MessageBox
  105.         A% = ExitWindows(EW_ExitWindows, 0)
  106.     Case 2 'If index =2, Reboot Computer
  107.         Msg = "Do you wish to Reboot your System?"
  108.         GoSub MessageBox
  109.         A% = ExitWindows(EW_Rebootsystem, 0)
  110. End Select
  111. MessageBox:
  112. If warn.Checked <> True Then
  113.         Return
  114.     Else
  115. Title = "Warning!"
  116. DgDef = MB_YESNO + MB_ICONINFORMATION + MB_DEFBUTTON2 'Describe Dialog Box
  117. Response = MsgBox(Msg, DgDef, Title)
  118.             If Response = IDYES Then
  119.                 Return
  120.             Else
  121.                 Exit Sub
  122.             End If
  123. End If
  124. End Sub
  125. Sub Exit_Click ()
  126. Unload quick
  127. End Sub
  128. Sub Stay_Click ()
  129. Stay.Checked = Not Stay.Checked
  130. If Stay.Checked = True Then
  131.     'Sets Stay on Top
  132.     wFlags% = SWP_NOMOVE Or SWP_NOSIZE
  133.     Call setWindowPos(quick.hWnd, HWND_TOPMOST, 0, 0, 0, 0, wFlags%)
  134.        'Sets Stay on Top Off
  135.         Else wFlags% = SWP_SHOWWINDOW
  136.         Call setWindowPos(quick.hWnd, 1, quick.CurrentX, quick.CurrentY, quick.Width, quick.Height, wFlags%)
  137.         SendKeys "%{TAB}" 'Transfers focus
  138. End If
  139. End Sub
  140. Sub Warn_Click ()
  141. warn.Checked = Not warn.Checked
  142. End Sub
  143.